<div ng-controller="Director_OrderDetailC">
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">计划单详情</h1>----
        <span ng-if="orderdetaildata.OrderType == 0">普通订单</span>
        <span ng-if="orderdetaildata.OrderType == 1">商品锁价</span>
        <span ng-if="orderdetaildata.OrderType == 2">基价锁价</span>
        <span ng-if="orderdetaildata.OrderType == 3">自采订单</span>
        <span ng-if="orderdetaildata.OrderType == 4">库提销售</span>
    </div>
    <div class="wrapper-md">
        <div class="panel panel-default">
            <div class="table-responsive">
                <form name="form" class="form-validation">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <div class="form-group">
                                <label>客户</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{orderdetaildata.Customer.ShortName}}">
                            </div>
                            <div class="form-group">
                                <label>公司户头</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{orderdetaildata.Account.Name}}">
                            </div>
                            <div class="form-group">
                                <label>区域</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{orderdetaildata.District.FillName}}">
                            </div>
                            <div class="form-group">
                                <label>具体地址</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{orderdetaildata.Address}}">
                            </div>
                            <div class="form-group">
                                <label for="xiankuan" style="margin-right: 10px;">是否先款</label>
                                <label class="i-checks">
                                    <input type="checkbox" id="xiankuan" disabled="disabled" ng-model="orderdetaildata.IsFullPayment">
                                    <i></i>
                                </label>
                                <label for="suojia" style="margin-right: 10px;">是否锁价</label>
                                <label class="i-checks">
                                    <input class="changeprice" id="suojia"  disabled="disabled" type="checkbox" ng-model="orderdetaildata.IsLockPrice">
                                    <i></i>
                                </label>
                            </div>
                            <div class="form-group">
                                <label for="biaojian" style="margin-right: 10px;">是否标件</label>
                                <label class="i-checks">
                                    <input type="checkbox" id="biaojian" disabled="disabled" ng-model="orderdetaildata.IsStandard">
                                    <i></i>
                                </label>
                                <label for="songhuo" style="margin-right: 10px;">是否送货</label>
                                <label class="i-checks">
                                    <input type="checkbox" id="songhuo" disabled="disabled" ng-model="orderdetaildata.IsDelivery">
                                    <i></i>
                                </label>
                            </div>
                            <div class="form-group" ng-if="orderdetaildata.IsDelivery">
                                <label style="margin-right: 10px;">运费是否公户</label>
                                <label class="i-checks">
                                    <input type="checkbox" disabled="disabled" ng-model="orderdetaildata.IsPublicDelivery">
                                    <i></i>
                                </label>
                            </div>
                            <div class="form-group" ng-if="orderdetaildata.IsDelivery">
                                <label>每吨运费</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{orderdetaildata.DeliveryPrice}}">
                            </div>
                            <div class="form-group" ng-if="!orderdetaildata.IsDelivery">
                                <label>车辆信息(每条信息以英文逗号分隔)</label>
                                <input type="text" ng-pattern="/^[a-zA-Z0-9\u4e00-\u9fa5,]+$/" class="form-control" readonly="readonly" ng-model="orderdetaildata.VehicleInfos">
                            </div>
                            <div class="form-group" ng-if="!orderdetaildata.IsDelivery">
                                <label>联系人(每条信息以英文逗号分隔)</label>
                                <input type="text" ng-pattern="/^[a-zA-Z0-9\u4e00-\u9fa5,]+$/" class="form-control" readonly="readonly" ng-model="orderdetaildata.Contact">
                            </div>
                            <div class="form-group" ng-if="!orderdetaildata.IsDelivery">
                                <label>联系人手机号(每条信息以英文逗号分隔)</label>
                                <input type="text" ng-pattern="/^[0-9,]+$/" class="form-control" readonly="readonly" ng-model="orderdetaildata.ContactPhone">
                            </div>
                            <div class="form-group">
                                <label>备注</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{orderdetaildata.Remarks}}">
                            </div>
                            <div class="form-group">
                                <label>申请单价优惠</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{orderdetaildata.ApplyDiscount}}">
                            </div>
                            <div class="form-group">
                                <label>申请总价优惠</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{orderdetaildata.BargainingAmount}}">
                            </div>
                            <div class="form-group">
                                <label ng-if="orderdetaildata.Provider.ProviderType == 0">钢厂</label>
                                <label ng-if="orderdetaildata.Provider.ProviderType == 1">仓库</label>
                                <label ng-if="orderdetaildata.Provider.ProviderType == 2">贸易商</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{orderdetaildata.Provider.Name}}">
                            </div>
                            <div class="form-group">
                                <label>已付金额：</label>
                                <span>{{orderdetaildata.Prepayments | number:2}}</span>
                            </div>
                            <div ng-if="orderdetaildata.Prepayments+orderdetaildata.PaidDelivery >= orderdetaildata.DeliveryPriceTotal+orderdetaildata.Total" class="form-group">
                                <label>计划单已付清</label>
                            </div>
                            <div ng-if="orderdetaildata.Prepayments+orderdetaildata.PaidDelivery < orderdetaildata.DeliveryPriceTotal+orderdetaildata.Total" class="form-group">
                                <label style="color: red">计划单未付清</label>
                            </div>
                            <div class="form-group">
                                <label>创建人：</label>
                                <span>{{orderdetaildata.Creater.Name}}</span>
                            </div>
                            <div class="form-group">
                                <accordion close-others="oneAtATime">
                                    <accordion-group heading="查看历史记录➤">
                                        <ul>
                                            <li ng-repeat="item in orderdetaildata.Records | orderBy:['CreateTime']">
                                                {{item.CreateTime}}/<label ng-if="item.Price != 0">{{item.Price | number:2}}/</label>{{item.Remarks}}
                                            </li>
                                        </ul>
                                    </accordion-group>
                                </accordion>
                            </div>
                            <div class="form-group">
                                <label>订单状态：</label>
                                <span style="width:10%" ng-if="orderdetaildata.State == 0">待确认</span>
                                <span style="width:10%" ng-if="orderdetaildata.State == 1">驻厂确认</span>
                                <span style="width:10%" ng-if="orderdetaildata.State == 2">已发货</span>
                                <span style="width:10%" ng-if="orderdetaildata.State == 3">已收货</span>
                                <span style="width:10%" ng-if="orderdetaildata.State == 4">已结算</span>
                                <span style="width:10%" ng-if="orderdetaildata.State == 5">完结</span>
                                <span style="width:10%" ng-if="orderdetaildata.State == 6">取消</span>
                                <span style="width:10%" ng-if="orderdetaildata.State == 7">审核通过</span>
                                <span style="width:10%" ng-if="orderdetaildata.State == 8">已退货</span>
                                <span style="width:10%" ng-if="orderdetaildata.State == 9">已退款</span>
                                <span style="width:10%" ng-if="orderdetaildata.IsSettlement">已结算</span>
                            </div>
                        </div>
                        <div class="container-fluid text-center bg-light lter" >
                            <div class="row">
                                <h3 style="display: inline-block;margin: 0 auto">订单商品列表</h3>
                            </div>
                        </div>
                        <div class="container-fluid" style="margin-top: 10px">
                            <div class="panel panel-default" ng-repeat="item in orderdetaildata.CommodityInfos" style="margin-bottom: 10px">
                                <div class="panel-heading">
                                    <div>品牌：{{item.Commodity.Brand}}</div>
                                </div>
                                <div class="panel-body">
                                    <div class="row">
                                        <div class="col-xs-12 col-md-12">
                                            <div>名称/材质/规格：{{item.Commodity.Name}}/{{item.Commodity.Standard}}/{{item.Commodity.Format}}</div>
                                            <div>单价：{{item.Price | number:2}}/t</div>
                                            <div>数量：{{item.Count}}</div>
                                            <div>总质量：{{item.Weight | number:3}}t</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="panel-footer">
                                    <div>总价：{{item.Price | number:2}}*{{item.Weight | number:3}}t={{item.Price*item.Weight | number:2}}</div>
                                </div>
                            </div>
                            <div class="row text-left container-fluid">
                                <span>预估价格：{{orderdetaildata.SourceTotal | number:2}}</span>
                            </div>
                            <div class="row text-left container-fluid" ng-if="orderdetaildata.UnitTotal > 0">
                                <span>先款/非标优惠合计：{{orderdetaildata.UnitTotal | number:2}}</span>
                            </div>
                            <!--<div class="row text-left container-fluid" ng-if="orderdetaildata.NonstandardDiscount > 0">-->
                            <!--<span>非标优惠：{{orderdetaildata.NonstandardDiscount | number:2}}</span>-->
                            <!--</div>-->
                            <div class="row text-left container-fluid" ng-if="orderdetaildata.ApplyDiscount > 0">
                                <span>单价优惠：{{orderdetaildata.ApplyDiscount | number:2}}</span>
                            </div>
                            <div class="row text-left container-fluid">
                                <h4 style="display: inline-block">总价：{{orderdetaildata.Total | number:2}}</h4>
                            </div>
                            <div class="row text-left container-fluid">
                                <h4 style="display: inline-block">运费：{{orderdetaildata.DeliveryPriceTotal | number:2}}</h4>
                            </div>
                            <div class="row text-right">
                                <button type="button" class="btn btn-success" ng-click="goorderList()">返回计划单列表</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    angular.module('app')
            //计划单详情控制器
            .controller("Director_OrderDetailC", function ($scope, $state, $stateParams, $http) {
                $scope.id = JSON.parse($stateParams.orderid);
                //获取计划单详细数据
                $http({
                    url: "../api/Order/Detail?id=" + $scope.id,
                    method: "GET"
                })
                        .then(function (res) {
                            $scope.orderdetaildata = res.data;
                            console.log($scope.orderdetaildata);
                        })
                        .then(function (error) {
                            if (error) {
                                console.log("error");
                            }
                        });
                //返回计划单列表
                $scope.goorderList = function () {
                    $state.go('app.Order_Director');
                };

            })
</script>